package Polymorphic.PolymorphDemo003;

/**
 * ClassName:Text
 * Package:Polymorphic.PolymorphDemo003
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/24-12:55
 * @Version:v1.0
 */
public class Text {
    public static void main(String[] args) {
        //创建对象并调用方法
//        Person p1 =new Person("老王",30);
//        Dog d = new Dog(2,"黑");
//        p1.keepPet(d,"骨头");
//
//        Person p2 = new Person("老李",25);
//        Cat c = new Cat(3,"灰色");
//        p2.keepPet(c,"鱼");


        //创建饲养员对象
        Person p1 = new Person("老王", 30);
        Dog d = new Dog(2, "黑");
        Cat c = new Cat(3,"灰色");
        p1.keepPet(d,"骨头");
        p1.keepPet(c,"鱼");

    }
}
